
<div class="row-content am-cf">
	<div class="row">
		<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
			<div class="widget am-cf">
				<div class="widget-head am-cf">
					<div class="widget-title  am-cf">借款区间分布</div>
				</div>
									
				   
				<form id="userReportForm" class="am-form am-form-horizontal" method="post" action="jkreport/excel">
					<div class="am-form-group">
						<label for="moneyFrom" class="am-u-lg-1 am-form-label">选择地区:</label>
						<div class="am-u-lg-2">
					 		<select id="areaName" data-am-selected="{btnWidth: '100%'}"  style="display: none;" name="areaName"  >
								<option th:each="item : ${areaList}" 	     th:value="${item.gradeNo}"    th:text="${item.areaName}" th:selected="${item.gradeNo==''}"></option>
							</select> 
						</div>
						
						<label class="am-u-sm-6 am-u-lg-1 am-form-label">选择时间：</label>
						<div class="am-u-sm-12 am-u-lg-2">
							<input type="text" placeholder="开始时间" th:value="${startTime}" id="startTime"  class="form-datetime-lang am-form-field" />
						</div>
						<div class="am-u-sm-12 am-u-lg-2 ">
							<input type="text" placeholder="结束时间" th:value="${endTime}" id="endTime"  class="form-datetime-lang am-form-field" />
						</div>
						<button type="button" class="am-btn am-btn-secondary " onclick="search()">查询</button>
					</div>
				</form>
				
				<div class="widget-body  am-fr">
					<table class="am-table am-table-bordered">
					    <thead>
					        <tr>
					            <th>借款金额区间</th>
					            <th>累计成功借款笔数</th>
					            <th>累计成功借款总额</th>
					        </tr>
					    </thead>
					    <tbody id="list">
					    </tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<script th:inline="javascript">
	<![CDATA[
		$(document).ready(function(){
			$('.form-datetime-lang').datepicker({format: 'yyyy-mm-dd'});
			$("#areaName").selected();
			search();
			
			
		});
		
		
		function search(){
			  var data = {
					  gradeNo:$("#areaName").val().trim(),
					  startTime:$("#startTime").val(),
					  endTime:$("#endTime").val()
			  };
			  
		      $.ajax({
		            type : "post",
		            url :  "businessSummary/getLoanSummary",
		            data:JSON.stringify(data),
		            contentType: 'application/json',
		            success : function(resultdata) {
		                if (resultdata.ret=="200") {
		                	if(resultdata.content.code == "10000"){
		                		var ary = [];
		                		for(var i=0;i<resultdata.content.info.list.length;i++){
		                			var item = resultdata.content.info.list[i];
		                			ary.push("<tr><td>");
		                			ary.push(item.startMoney+"-"+item.endMoney);
		                			ary.push("</td><td>");
		                			ary.push(item.num+"</td>");
		                			ary.push("<td>"+item.amount+"</td>");
		                			ary.push("</tr>");
		                		}
		                		$("#list").html(ary.join(""));
		                	}
		                } else {
		                    layer.msg(resultdata.message, {
		                        icon : 0
		                    });
		                }
		            },
		            error : function(errorMsg) {
		                layer.msg('服务器未响应,请稍后再试', {
		                    icon : 3
		                });
		            }
		        });
			
		}
		

		]]>
	</script>

